/*
 * =====================================================================================
 *    Description:  select m from n persons which minimize |D{j} - P{j}|
 *        Version:  1.0
 *        Created:  09/13/2012 11:34:39 PM
 * =====================================================================================
 */
#include	<stdio.h>
#include	<string.h>
#include	<algorithm>

#define mset(x,y) (memset(x,y,sizeof(x)))
#define for0(n) for(int i=0 ; i<n ;++i)
#define for1(n) for(int i=1 ; i<=n ;++i)
#define _for0(n) for(int i=n ; i>=0 ;--i)
#define _for1(n) for(int i=n ; i>0 ;--i)

int pro[216];
int den[216];
int sub[216];
int plus[216];

int dp[21][804];
int path[21][804];
int candqueue[21][804]; 
int resultSeq[32];
int n, m;
int splitPoint;
int minValue;
int maxValue;

void dpSearch()
{
    int qcnt[21]; 
    //init queue
    memset(qcnt, 0x00, sizeof(qcnt));
    qcnt[0] = 1;
    candqueue[0][0] = splitPoint;
    //init dp first item
    memset(dp , -1 ,sizeof(dp));
    dp[0][splitPoint] = 0;

    for (int i = 1; i <= m; ++i)
    {
        //iterate all the already computered value
        for (int u = 0; u < qcnt[i-1]; ++u)
        {
            int v = candqueue[i-1][u];
            for (int j = 0; j < n; ++j)
            {
                int k = sub[j] + v;
                if (dp[i][k] < dp[i-1][v] + plus[j]) {
                    int t = i - 1;
                    int pos = v;
                    while (t > 0 && path[t][pos] != j)
                    {
                        pos = pos - sub[path[t][pos]];
                        --t;
                    }
                    if (t <= 0) {
                        dp[i][k] = dp[i-1][v] + plus[j];
                        path[i][k] = j;
                        candqueue[i][qcnt[i]] = k;
                        ++qcnt[i];
                    }
                }
            }
        }
    }
}

void getAns()
{
    int i = 0;
    for (i = 0; i <= splitPoint; ++i)
    {
        if (dp[m][splitPoint + i] != -1 
            || dp[m][splitPoint-i] != -1)
            break;
    }
    if (dp[m][splitPoint + i] < dp[m][splitPoint - i])
        i = -i;

    minValue = i;
    int k = i + 20 * m;
    maxValue = dp[m][k];
    for (int i = 0; i < m; ++i)
    {
        resultSeq[i] = path[m-i][k];
        k = k - sub[resultSeq[i]];
    }
}

int main(int argc, char *argv[])
{
    //注意初始化
    int seqNo = 0;
    while (scanf("%d%d", &n, &m) == 2)
    {
        if (n == 0 && m == 0)
            break;
        ++seqNo;
        for0(n)
        {
            scanf("%d%d", &pro[i], &den[i]);
            sub[i] = pro[i] - den[i];
            plus[i] = pro[i] + den[i];
        }
        splitPoint = 20 * m;
        dpSearch();
        getAns();
        std::sort(resultSeq, resultSeq+m);
        printf("Jury #%d\n", seqNo);
        printf("Best jury has value %d for prosecution and value %d for defence:\n", 
                (minValue + maxValue)/2, (maxValue - minValue)/2);
        for (int j = 0; j < m; ++j)
            printf ( " %d", resultSeq[j]+1);
        printf ( "\n\n" );
    }
    return 0;
}
